package com.yf.catcafe.service.impl;

import com.yf.catcafe.mapper.CoffesMapper;
import com.yf.catcafe.pojo.dto.AddCafeDto;
import com.yf.catcafe.pojo.enity.Cafe;
import com.yf.catcafe.service.CoffesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class CoffesServiceIimpl implements CoffesService {

    @Autowired
    private CoffesMapper coffesMapper;

    @Override
    public List<Cafe> query() {
        List<Cafe> cafes=coffesMapper.query();
        return cafes;
    }

    @Override
    public Cafe getDetails(Long id) {
        Cafe cafe=coffesMapper.getDetails(id);
        return cafe;
    }

    @Override
    public List<Cafe> queryByCategory(String category) {
        List<Cafe> cafes=coffesMapper.queryByCategory(category);
        return cafes;
    }

    @Override
    public List<Cafe> queryByName(String name) {
        List<Cafe> cafes=coffesMapper.queryByName(name);
        return cafes;
    }

    @Override
    public void add(AddCafeDto addCafeDto) {
        coffesMapper.add(addCafeDto);
    }

    @Override
    public List<Cafe> seckillCafe() {
        List<Cafe> cafes=coffesMapper.seckillCafe();
        return cafes;
    }
}
